<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function getnum() {
            const arr = [3, 5, 7, 9, 18]
            arr.map(function (item, index) {
                if (item === 3 || item === 9) {
                    arr.splice(index, 1)
                }
            })
            console.log(arr);
        }
        getnum() 
    </script>
</body>

</html>